# 运算符
# 公共⽅法
# 容器类型转换
print('--------------字符串运算符-------------------')
str1 = "sdlflsf" + '2222222'
print(str1)
str1 = '1' * 8
print(str1)
print('1' in str1)
print('0' not in str1)
print('-------------列表--------------------')
list1 = [10, 20, 30] + [40, 50, 60]
print(list1)
list1 = [10, 20, 30] * 2
print(list1)
print(10 in list1)
print(10 not in list1)
print('---------------元组------------------')
tuple1 = (10, 20, 30) + (40, 50)
print(tuple1)
tuple1 = (10, 20) * 3
print(tuple1)

print(10 in tuple1)
print(10 not in tuple1)
print('-------------字典--------------------')
dict1 = {'key1': 'value1', 'key2': 'value2'}

print('key1' in dict1)
print('key2' in dict1)
print()
print('---------------公共方法------------------')

print('--------------len 长度-------------------')
print(f'列表长度{len(list1)}')
print(f'元组长度{len(tuple1)}')
print(f'字典长度{len(dict1)}')
print(f'字符串长度{len(str1)}')
print(f'集合长度{len({1, 2, 3})}')
print('-------------del 删除--------------------')
print(list1)
del list1[0]
print(f'删除{list1}')
del dict1['key1']
print(dict1)
del str1
# NameError: name 'str1' is not defined
# print(str1)

print('-----------max 最大 列表,元组,集合,字符串,字典----------------------')
list_max = max(list1)
tuple_max = max(tuple1)
set1 = {10, 20, 30}
set_max = max(set1)
print(list_max)
print(tuple_max)
print(set_max)
dict1 = {'key1': 'value1', 'key2': 'value2'}
print(max(dict1))
str1 = "12345"
print(max(str1))
print('-----------min 最小  列表,元组,集合,字符串,字典----------------------')
print(min(list1))
print(min(tuple1))
print(min(str1))
print(min(set1))
print(min(dict1))
print()
print('-------------range()⽣成的序列不包含end数字。--------------------')
for i in range(2):
    print(i, end='')

print()
# [start,end),步长
for i in range(1, 10, 3):
    print(i, end='')
print()
print('------------enumerate start参数⽤来设置遍历数据的下标的起始值，默认为0。---------------------')
# 快速查找
list1 = ['a', 'b', 'c', 'd', 'e']
for i in (list1):
    print(i, end='')
print()
#     enumerate的下标起始点,默认0 
for i in enumerate(list1):
    print(i, end='')
print()
for index, value in enumerate(list1):
    print(f'index:{index},value:{value}')
print()
print('-------------tuple () list() set() dict() str()--------------------')
tuple1 = tuple({1, 2, 3, 4})
print(tuple1)
print(type(tuple1))
print(type(str(1)))
print((set((10, 20, 20))))
print((list((10, 20, 20))))
print((str((10, 20, 20))))
print((tuple({10, 20, 20, 30})))
print((10, 20, 20, 30))

print('-------------set可以使用减法--------------------')
print()
